﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace liaowa2.Api.Controllers
{
    /// <summary>
    /// Tests授权描述
    /// </summary>
    public class TestController : ApiController
    {
        /// <summary>
        /// 测试oauth2是否授权规则
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public string GetOauth2Spec()
        {
            return @"Post请求 
                          /oauth2/token  
                         |Head(key,value) 
                         Authorization:
                         grant_type=client_credentials&client_id=irving&client_secret=a0b99b5d0c096c2386baf2eb9fe53610
                        请求其他接口 Authorization:token";
        }

        /// <summary>
        /// 授权成功
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        [Authorize]
        public string GetOauthSuccess()
        {
            return "授权成功";
        }

    }
}
